import java.util.Locale;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: syyyy
 * Date: 2025-07-12
 * Time: 12:14
 */
public class PalindromeString {
    public boolean isPalindrome(String s){
        s=s.toLowerCase();
        int left=0;
        int right=s.length()-1;
        while(left<right){
            while(left<right&&!isNumberorChar(s.charAt(left))){
                left++;
            }
            while(left<right&&!isNumberorChar(s.charAt(right))){
                right++;
            }
            if(s.charAt(left)!=s.charAt(right)){
                return false;
            }else{
                left++;
                right++;
            }

        }
        return true;


    }

    private boolean isNumberorChar(char ch){
        if(Character.isDigit(ch)||Character.isLetter(ch)){
            return true;
        }else{
            return false;
        }
    }

}
